package com.neepu.serviceImpl;

import com.neepu.dao.UserMapper;
import com.neepu.pojo.User;
import com.neepu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Transactional(propagation= Propagation.REQUIRED,isolation= Isolation.DEFAULT)
@Service("UserService")
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User login(String loginname, String password,Integer role) {
        return  userMapper.login(loginname,password,role);
    }

    @Override
    public User toFindPassword(String loginname, String email, Integer role) {
        return userMapper.toFindPassword(loginname, email, role);
    }

    @Override
    public void updatePassword(User user) {
        userMapper.updatePassword(user);
    }

    @Override
    public User finUserById(String id) {
        return userMapper.finUserById(id);
    }

    @Override
    public List<User> finUserByRole() {
        return userMapper.finUserByRole();
    }

    @Override
    public List<User> finUserByContent(String content) {
        return userMapper.finUserByContent(content);
    }
}
